from django.db import models
from django.contrib.auth.models import AbstractUser

# Create your models here.


class Info(AbstractUser):
    phone = models.CharField(max_length=20,null=True,blank=True)
    tel = models.CharField(max_length=20,null=True,blank=True)

    class Meta:
        db_table = 'tb_user'
        verbose_name = '用户信息'
        verbose_name_plural = verbose_name


class RecvInfo(models.Model):
    area = models.ForeignKey('common.Area',on_delete=models.SET_NULL,verbose_name='区域',blank=True,null=True)
    detail = models.CharField(max_length=50,verbose_name='详细地址')
    info = models.ForeignKey('Info',on_delete=models.CASCADE,verbose_name='所属用户')
    phone = models.CharField(max_length=11,verbose_name='收货人号码')
    name = models.CharField(max_length=11,verbose_name='收货人姓名')
    is_default = models.BooleanField(verbose_name='是否为默认地址')
    create = models.DateTimeField(verbose_name='创建时间')
    update = models.DateTimeField(verbose_name='更新时间')

    class Meta:
        db_table = 'tb_user_recvinfo'
        verbose_name = '用户收货信息'
        verbose_name_plural = verbose_name

